import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';

@Injectable({
  providedIn: 'root'
})
export class MessgaeService {
  data = '/Message';
  constructor(private http: HttpClient) { }
  GetPagedMessage(filter:any){
    const GetPagedMessage = '/GetPagedMessage';
    return this.http.get(`${environment.apiUrl}${this.data}${GetPagedMessage}`,{params:filter})
  }
  SetMessageAsRead(filter:any){
    const SetMessageAsRead = '/SetMessageAsRead';
    return this.http.put(`${environment.apiUrl}${this.data}${SetMessageAsRead}`,null,{params:filter})
  }
  DeleteBatchMessage(filter: any, data: any) {
    const DeleteBatchMessage = '/DeleteBatchMessage';
    return this.http.request('delete', `${environment.apiUrl}${this.data}${DeleteBatchMessage}`, {
        body: data,
        params: filter
    });
  }
  SetBatchMessageAsRead(filter:any,data:any){
    const SetBatchMessageAsRead = '/SetBatchMessageAsRead';
    return this.http.put(`${environment.apiUrl}${this.data}${SetBatchMessageAsRead}`,data,{params:filter})
  }
}
